﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Interfaces="clr-namespace:Emcc.TeamSystem.TaskBoard.Core.Interfaces;assembly=Emcc.TeamSystem.TaskBoard.Core"
    xmlns:Constants1="clr-namespace:Emcc.TeamSystem.TaskBoard.TaskBoardUI.Constants"
    xmlns:TaskBoardUI="clr-namespace:Emcc.TeamSystem.TaskBoard.TaskBoardUI"
    xmlns:UIElements="clr-namespace:Emcc.TeamSystem.TaskBoard.UIElements;assembly=Emcc.TeamSystem.TaskBoard.UIElements"
    xmlns:DragHelpers="clr-namespace:Emcc.TeamSystem.TaskBoard.UIElements.DragHelpers;assembly=Emcc.TeamSystem.TaskBoard.UIElements">

    <DataTemplate x:Key="ParentCellTemplate" DataType="{x:Type Interfaces:ITaskBoardItem}">
        <Grid Height="{x:Static Constants1:Numbers.RowHeight}">
            <StackPanel HorizontalAlignment="Right" VerticalAlignment="Top" Orientation="Horizontal" >
                <Button 
                    CommandParameter="{Binding Parent}" 
                    Command="{x:Static UIElements:CommandLibrary.EditItem}" 
                    Margin="0,0,5,0"
                    >
                    <StackPanel Orientation="Horizontal">
                        <TextBlock xml:space="preserve">Edit: </TextBlock>
                        <TextBlock Text="{Binding [System.Id]}" />
                    </StackPanel>
                </Button>
                <Button CommandParameter="{Binding ChildCreationArguments}" Command="{x:Static UIElements:CommandLibrary.CreateChild}">New Child</Button>
            </StackPanel>
            <StackPanel Orientation="Vertical" MaxHeight="175" VerticalAlignment="Center">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Parent.DisplayNames[System.Id]}" FontWeight="Bold" />
                    <TextBlock xml:space="preserve">: </TextBlock>
                    <TextBlock Text="{Binding Parent[System.Id]}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Parent.DisplayNames[System.WorkItemType]}" FontWeight="Bold" />
                    <TextBlock xml:space="preserve">: </TextBlock>
                    <TextBlock Text="{Binding Parent[System.WorkItemType]}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Parent.DisplayNames[System.State]}" FontWeight="Bold" />
                    <TextBlock xml:space="preserve">: </TextBlock>
                    <TextBlock Text="{Binding Parent[System.State]}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Parent.DisplayNames[System.Title]}" FontWeight="Bold" />
                    <TextBlock xml:space="preserve">: </TextBlock>
                    <TextBlock Text="{Binding Parent[System.Title]}" TextWrapping="WrapWithOverflow" />
                </StackPanel>
                <TextBlock Text="{Binding Parent[System.Description]}" TextWrapping="WrapWithOverflow" />
            </StackPanel>
        </Grid>
    </DataTemplate>

    <DataTemplate x:Key="RowHeaderTemplate" DataType="{x:Type Interfaces:IView}">
        <TextBlock Name="HeaderText" Text="{Binding .}" />
    </DataTemplate>

    <DataTemplate x:Key="ColumnTemplate1" DataType="{x:Type Interfaces:ISwimLaneRow}">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.SwimLaneColumns[0]}" />
    </DataTemplate>

    <DataTemplate x:Key="ColumnTemplate2" DataType="{x:Type Interfaces:ISwimLaneRow}">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.SwimLaneColumns[1]}" />
    </DataTemplate>

    <DataTemplate x:Key="ColumnTemplate3" DataType="{x:Type Interfaces:ISwimLaneRow}">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.SwimLaneColumns[2]}" />
    </DataTemplate>

    <DataTemplate x:Key="ColumnTemplate4" DataType="{x:Type Interfaces:ISwimLaneRow}">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.SwimLaneColumns[3]}" />
    </DataTemplate>

    <DataTemplate x:Key="ColumnTemplate5" DataType="{x:Type Interfaces:ISwimLaneRow}">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.SwimLaneColumns[4]}" />
    </DataTemplate>

    <DataTemplate x:Key="ColumnTemplate6" DataType="{x:Type Interfaces:ISwimLaneRow}">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.SwimLaneColumns[5]}" />
    </DataTemplate>

    <DataTemplate x:Key="BucketCellTemplate0">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.BucketStates[0]}" />
    </DataTemplate>

    <DataTemplate x:Key="BucketCellTemplate1">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.BucketStates[1]}" />
    </DataTemplate>

    <DataTemplate x:Key="BucketCellTemplate2">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.BucketStates[2]}" />
    </DataTemplate>

    <DataTemplate x:Key="BucketCellTemplate3">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.BucketStates[3]}" />
    </DataTemplate>

    <DataTemplate x:Key="BucketCellTemplate4">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.BucketStates[4]}" />
    </DataTemplate>

    <DataTemplate x:Key="BucketCellTemplate5">
        <TaskBoardUI:StateCollectionView 
            StateCollection="{Binding RelativeSource={RelativeSource AncestorType={x:Type ContentPresenter}}, Path=DataContext.BucketStates[5]}" />
    </DataTemplate>

    <DataTemplate x:Key="TaskBoardItemTemplate" DataType="{x:Type Interfaces:ITaskBoardItem}">
        <Border 
            Margin="2" 
            Width="150" 
            Height="90" 
            BorderBrush="Black" 
            BorderThickness="1" 
            Background="Beige"
            TextBlock.Foreground="Black"
            Cursor="{x:Static UIElements:CustomCursors.Hand}"
            >
            <Grid Margin="2">
                <StackPanel>
                    <TextBlock Text="{Binding [System.WorkItemType]}" />
                    <TextBlock Text="{Binding [System.State]}" />
                    <TextBlock Text="{Binding [System.Title]}" TextWrapping="WrapWithOverflow" TextTrimming="CharacterEllipsis" />
                </StackPanel>
                <Button VerticalAlignment="Bottom" CommandParameter="{Binding}" Command="{x:Static UIElements:CommandLibrary.EditItem}" Cursor="Arrow">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock xml:space="preserve">Edit:</TextBlock>
                        <TextBlock Text="{Binding [System.Id]}" />
                    </StackPanel>
                </Button>
            </Grid>
        </Border>
    </DataTemplate>
    
    <DataTemplate x:Key="OrphanCellTemplate">
        <DragHelpers:DragListView 
            ItemsSource="{Binding Orphans}" 
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
            MinWidth="{x:Static Constants1:Numbers.MinContainerWidth}"
            Height="{x:Static Constants1:Numbers.RowHeight}"
            ItemTemplate="{StaticResource TaskBoardItemTemplate}"
            Background="Transparent"
            >
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel IsItemsHost="True"  />
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>
        </DragHelpers:DragListView>
    </DataTemplate>

</ResourceDictionary>